package com.ht.action;



import com.ht.rules.RuleTest;
import com.ht.service.LoginService;
import com.ht.service.impl.LoginServiceImpl;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.sample.DroolsTest;
/**
 * 
 * @author ht 
 * 	2010 10 20
 *
 */
public class LoginAction extends ActionSupport{
	private String staffName;
	private String staffPsw;
	private LoginServiceImpl loginService = new LoginServiceImpl();
	
	public String loginIn(){		
		System.out.println("name="+staffName+",pwd="+staffPsw);
		RuleTest ruleTest = new RuleTest();
		ruleTest.test();
		DroolsTest droolsTest = new DroolsTest();
		droolsTest.test();
		if(loginService.isLogin(staffName, staffPsw)){
			ActionContext.getContext().getSession().put("staffName", staffName);	//保存当前用户
			return "index";
		}
			return LOGIN;
		
	}
	

	

	public LoginService getLoginService() {
		return loginService;
	}

	public void setLoginService(LoginServiceImpl loginService) {
		this.loginService = loginService;
	}

	public String getStaffName() {
		return staffName;
	}

	public void setStaffName(String staffName) {
		this.staffName = staffName;
	}

	public String getStaffPsw() {
		return staffPsw;
	}

	public void setStaffPsw(String staffPsw) {
		this.staffPsw = staffPsw;
	}
}
